import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AccountHistoryVO, AccountHistoryForm, AccountHistoryQuery } from '@/api/retail/accountHistory/types';

/**
 * 查询资金账号历史列表
 * @param query
 * @returns {*}
 */

export const listAccountHistory = (query?: AccountHistoryQuery): AxiosPromise<AccountHistoryVO[]> => {
  return request({
    url: '/retail/accountHistory/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询资金账号历史详细
 * @param id
 */
export const getAccountHistory = (id: string | number): AxiosPromise<AccountHistoryVO> => {
  return request({
    url: '/retail/accountHistory/' + id,
    method: 'get'
  });
};

/**
 * 新增资金账号历史
 * @param data
 */
export const addAccountHistory = (data: AccountHistoryForm) => {
  return request({
    url: '/retail/accountHistory',
    method: 'post',
    data: data
  });
};

/**
 * 修改资金账号历史
 * @param data
 */
export const updateAccountHistory = (data: AccountHistoryForm) => {
  return request({
    url: '/retail/accountHistory',
    method: 'put',
    data: data
  });
};

/**
 * 删除资金账号历史
 * @param id
 */
export const delAccountHistory = (id: string | number | Array<string | number>) => {
  return request({
    url: '/retail/accountHistory/' + id,
    method: 'delete'
  });
};
